package com.zhiyou100.crm.service.impl;

import com.zhiyou100.crm.dao.DepartmentDao;
import com.zhiyou100.crm.service.DepartmentService;
import com.zhiyou100.crm.pojo.Department;
import com.zhiyou100.crm.util.S_session;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.util.List;
@Service("departmentServiceImpl")
public class DepartmentServiceImpl implements DepartmentService {
//    DepartmentDao departmentDao=new DepartmentDaoImpl();

    @Autowired
    private DepartmentDao departmentDao;
    @Override
    public List<Department> queryAll() throws IOException {
        List<Department> departments = departmentDao.queryAll();
        return departments;
    }

    @Override
    public int addDepartment(Department department) throws IOException {
        int a = departmentDao.addDepartment(department);
        return a;
    }

    @Override
    public int deleteById(int departmentId) throws IOException {
        int a = departmentDao.deleteById(departmentId);
        return a;
    }

    @Override
    public int updateDepartment(Department department) throws IOException {
        int a = departmentDao.updateDepartment(department);
        return a;
    }
}
